import Mock from "mockjs";

const { data } = Mock.mock({
  // 20条数据
  "data|20": [
    {
      // 广告图片
      goodsImg: "@Image('150x60','@color','好鞋')",
      // 投放标题
      "goodsName|1": [
        "乔丹Jordan",
        "耐克NIKE",
        "阿迪达斯Adidas",
        "AJ低帮藤原浩闪电",
        "DUNK SB黑白熊猫",
        "OW联名鞋",
      ],
      // 投放位置
      "goodsShop|1": ["淘宝", "天猫", "拼多多", "抖音", "得物"],
      // 类别
      "goodsClassify|1": ["banner","直通车","活动页"],
      // 投放位置
      goodsSize: "1920*600",
      // 创建时间
      goodsDate: "20220-08-26 16:15",
      //单价
      "goodsSale|300-500": 300,
      // 状态
      "goodsState|1": "@boolean",
      // 商品Id
      "goodsId|+1": 1,
    },
  ],
});

interface ParamsType {
  page: number;
  size: number;
}

class ProductServe {
  getData({ page, size }: ParamsType) {
    return new Promise((resolve) => {
      const result = data.slice((page - 1) * size, page * size);
      resolve({
        status: 0,
        result: result,
        count: data.length,
      });
    });
  }
}

const advenment = new ProductServe();
export default advenment;
